﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smartec.Accounts.Camel.AMS.Model.Entities;
using Smartec.Accounts.Camel.AMS.Model.Repository;

namespace Smartec.Accounts.Camel.AMS.Model.Facades
{
    public static class RegisteredFacade
    {
        public static void AddRegestered(Registered Registered)
       {
           RegisteredRepository.AddRegistered(Registered);
          
       }

        public static List<Registered> GetAllRegistered()
       {
           return RegisteredRepository.All();
       }

        public static Registered GetRegisteredById(int id)
       {
           return  RegisteredRepository.All().FirstOrDefault(t=>t.ID==id);
       }
       public static void Save()
       {
           RegisteredRepository.Save();
       }
       public static void UpdateRegistered(Registered Registered)
       {
           var _Registered = GetRegisteredById(Registered.ID);
           _Registered.Name = Registered.Name;
           _Registered.Email = Registered.Email;
           _Registered.IsActive = Registered.IsActive;
       }

       public static void DeleteRegisteredById(int id)
       {
           RegisteredRepository.DeleteRegisteredById(id);
       }



       public static Registered GetRegisteredByGuid(Guid guid)
       {
           return GetAllRegistered().FirstOrDefault(r => r.Guid == guid);
       }

       public static Registered GetRegisteredByEmail(string Email)
       {
           return GetAllRegistered().FirstOrDefault(r => r.Email == Email);
       }
    }
}
